home *** CD-ROM | disk | FTP | other *** search
/ Aminet 12 / Aminet 12 (1996)(GTI - Schatztruhe)[!][Jun 1996].iso / Aminet / dev / e / framework.lha / fw / any.e next >
Encoding:
Text File  |  1996-01-27  |  2.9 KB  |  69 lines

  1.  
  2. -> ANY is the upper class of the framework as it has no parent.
  3. -> This general object has no field to minimize memory usage.
  4. -> The aim of this framework is to have as much abstract classes
  5. -> as possible, doing so we provide more power and flexibility to
  6. -> concrete classes. So don't expect these classes to be useful, but
  7. -> inherit from them to get all OO benefits. There is only one class per
  8. -> file as this improves readability and flexibility. This framework
  9. -> is only for OS V36+ users, but some classes could be only for V37+,
  10. -> V39+, or AGA only, if required (or just justified by my lazyness).
  11. -> Source is also highly documented so separate documentation is useless.
  12. -> For each class method the required preconditions are given before the
  13. -> header, read them to prevent bad usage. Note that preconditions also
  14. -> apply to redefined methods but are not repeated, there is no additionnal
  15. -> precondition for redefined methods, this doesn't mean there is no
  16. -> precondition at all.
  17. -> I hope you will find this class set as powerful as you wish.
  18. -> Most of all I hope it is an example of ONE good programming style, though
  19. -> quite different of whatever I previously seen in E. This doesn't mean
  20. -> other E programmers (including Wouter itself) have bad style, they just
  21. -> prefer lower level of abstraction and have already provide large amount
  22. -> of excellent examples for that.
  23. -> The signs of my departure are: (to be interpreted either as goods or bads)
  24. -> * smallTalk naming convention
  25. -> * heavy comment
  26. -> * high level of inheritance
  27. -> * many abstract classes, most classes of this framework can be considered
  28. ->   as abstract and you will probably inherit of them again!
  29. -> * no PRIVATE fields! as it would prevent me to use them in heirs, due
  30. ->   to class-level abstraction. So usage of this framework require special
  31. ->   attention to prevent data-hiding violation. But this is quite easy,
  32. ->   use only stuff that is usefull to the consumer point of view.
  33.  
  34. -> Copyright © Guichard Damien 01/04/1996
  35.  
  36. OPT MODULE
  37. OPT EXPORT
  38.  
  39. OBJECT any
  40. ENDOBJECT
  41.  
  42. -> Return a copy of this object.
  43. -> Any E object can be cloned using this function.
  44. PROC clone() OF any
  45.   DEF copy:PTR TO any
  46.   copy:=FastNew(Long(^self))
  47.   CopyMem(self+SIZEOF LONG,copy,Long(^self)-SIZEOF LONG)
  48. ENDPROC copy
  49.  
  50. -> Copy 'other' object to this object.
  51. -> Any E object can be copied using this function.
  52. -> 'other' class MUST be the same as this object class (or a parent).
  53. PROC copy(other:PTR TO any) OF any
  54.   CopyMem(other+4,self+4,Long(^other)-SIZEOF LONG)
  55. ENDPROC
  56.  
  57. -> Print a readeable form of the object to standard output.
  58. -> As a default print the address of the object in hexadecimal.
  59. -> As an example of required precondition, I use buffered IO, so
  60. -> console MUST be opened, so here (and whenever I perform console IO
  61. -> from now) a previous WriteF('') call is REQUIRED.
  62. PROC out() OF any
  63.   VfPrintf(stdout,'$\h ',[self])
  64. ENDPROC
  65.  
  66. -> Size of this object.
  67. PROC size() OF any IS Long(^self)
  68.  
  69.